import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PagesComponent } from './pages.component';
import { NgxPermissionsGuard } from 'ngx-permissions';
import { ErrorPageComponent } from './snippets/error-page/error-page.component';
import { EmptyPageComponent } from './snippets/empty-page/empty-page.component';
import { ResetPasswordComponent } from './snippets/reset-password/reset-password.component';

const routes: Routes = [
	{
		path: '',
		component: PagesComponent,
		canActivate: [NgxPermissionsGuard],
		data: {
			permissions: {
				only: ['ADMIN', 'USER'],
				except: ['GUEST'],
				redirectTo: '/login',
			},
		},
		children: [
			{
				path: 'force-reload',
				component: EmptyPageComponent,
			},
			{
				path: '',
				loadChildren: 'app/modules/dashboard/dashboard.module#DashboardModule',
			},
			{
				path: 'zone',
				loadChildren: 'app/modules/zone/zone.module#ZoneModule',
			},
			{
				path: 'personnel',
				loadChildren: 'app/modules/personnel/personnel.module#PersonnelModule',
			},
			{
				path: 'computer',
				loadChildren: 'app/modules/computer/computer.module#ComputerModule',
			},
			{
				path: 'software',
				loadChildren: 'app/modules/software/software.module#SoftwareModule',
			},
			{
				path: 'form',//
				loadChildren: 'app/modules/form/form.module#FormModule',
			  },
			{
				path: 'message',
				loadChildren: 'app/modules/message/message.module#MessageModule',
			},
			{
				path: 'task',
				loadChildren: 'app/modules/task/task.module#TaskModule',
			},
			{
				path: 'logs',
				loadChildren: 'app/modules/log/log.module#LogModule',
			},
			{
				path: 'settings',
				loadChildren: 'app/modules/settings/settings.module#SettingsModule',
			},
			{
				path: 'ssh',
				loadChildren: 'app/modules/ssh/ssh.module#SshModule',
			},
			{
				path: 'usb-device',
				loadChildren: 'app/modules/usb-device/usb-device.module#UsbDeviceModule'
			}
			// {
			// 	path: 'mail',
			// 	loadChildren: './components/apps/mail/mail.module#MailModule'
			// },
			// {
			// 	path: 'ecommerce',
			// 	loadChildren: './components/apps/e-commerce/e-commerce.module#ECommerceModule'
			// },
			// {
			// 	path: 'ngbootstrap',
			// 	loadChildren: './components/ngbootstrap/ngbootstrap.module#NgbootstrapModule'
			// },
			// {
			// 	path: 'material',
			// 	loadChildren: './components/material/material.module#MaterialModule'
			// },
			// {
			// 	path: 'metronic',
			// 	loadChildren: './components/metronic/metronic.module#MetronicModule'
			// },
			// {
			// 	path: 'user-management',
			// 	loadChildren: './components/user-management/user-management.module#UserManagementModule'
			// },
			// {
			// 	path: 'audit-log',
			// 	loadChildren: './components/apps/audit-log/audit-log.module#AuditLogModule'
			// },
			// {
			// 	path: 'builder',
			// 	loadChildren: './builder/builder.module#BuilderModule'
			// },
			// {
			// 	path: 'header/actions',
			// 	component: ActionComponent
			// },
			// {
			// 	path: 'profile',
			// 	component: ProfileComponent
			// }
		],
	},
	{
		path: 'login',
		canActivate: [NgxPermissionsGuard],
		loadChildren: 'app/modules/login/login.module#LoginModule',
		data: {
			permissions: {
				except: 'USER',
				redirectTo: '/',
			},
		},
	},
	{
		path: 'password_reset',
		component: ResetPasswordComponent
	},
	{
		path: '404',
		component: ErrorPageComponent,
	},

	{
		path: 'error/:type',
		component: ErrorPageComponent,
	},
];

@NgModule({
	imports: [RouterModule.forChild(routes)],
	exports: [RouterModule],
})
export class PagesRoutingModule { }
